Skip to content

fix: mark malformed SafeTensors scans inconclusive#913

Merged
mldangelo-oai merged 3 commits intomainfrom
mdangelo/codex/safetensors-boundary-audit
Apr 11, 2026
Merged

fix: mark malformed SafeTensors scans inconclusive#913
mldangelo-oai merged 3 commits intomainfrom
mdangelo/codex/safetensors-boundary-audit

Conversation

@mldangelo-oai
Copy link
Copy Markdown
Contributor

Summary

  • add explicit inconclusive scan_outcome metadata for malformed SafeTensors headers and tensor framing
  • validate data_offsets structure, dtype, and shape before trusting tensor size/coverage checks
  • ensure corrupt non-malicious SafeTensors returns exit 2 while real security findings still return exit 1

Validation

  • uv run --extra safetensors pytest tests/scanners/test_safetensors_scanner.py
  • uv run ruff format modelaudit/ packages/modelaudit-picklescan/src packages/modelaudit-picklescan/tests tests/
  • uv run ruff check --fix modelaudit/ packages/modelaudit-picklescan/src packages/modelaudit-picklescan/tests tests/
  • uv run mypy modelaudit/ packages/modelaudit-picklescan/src packages/modelaudit-picklescan/tests tests/
  • uv run pytest -n auto -m "not slow and not integration" --maxfail=1
  • uv run ruff format --check modelaudit/ packages/modelaudit-picklescan/src packages/modelaudit-picklescan/tests tests/
  • uv run ruff check modelaudit/ packages/modelaudit-picklescan/src packages/modelaudit-picklescan/tests tests/
  • git diff --check

@mldangelo-oai mldangelo-oai enabled auto-merge (squash) April 10, 2026 18:35
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 10, 2026

Warning

Rate limit exceeded

@mldangelo-oai has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 11 minutes and 50 seconds before requesting another review.

Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 11 minutes and 50 seconds.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 089c62b6-5984-447a-966d-43241574d80b

📥 Commits

Reviewing files that changed from the base of the PR and between 66b4871 and 6fcef94.

📒 Files selected for processing (3)
  • CHANGELOG.md
  • modelaudit/scanners/safetensors_scanner.py
  • tests/scanners/test_safetensors_scanner.py
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch mdangelo/codex/safetensors-boundary-audit

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 10, 2026

Workflow run and artifacts

Performance Benchmarks

Compared 6 shared benchmarks with a regression threshold of 15%.
Status: 0 regressions, 0 improved, 6 stable, 0 new, 0 missing.
Aggregate shared-benchmark median: 702.57ms -> 677.26ms (-3.6%).

Benchmark Target Size Files Baseline Current Change Status
tests/benchmarks/test_scan_benchmarks.py::test_scan_duplicate_directory duplicate-corpus 840.0 KiB 81 503.06ms 480.74ms -4.4% stable
tests/benchmarks/test_scan_benchmarks.py::test_validate_file_type_pytorch_zip state_dict.pt 1.5 MiB 1 48.9us 47.3us -3.3% stable
tests/benchmarks/test_scan_benchmarks.py::test_scan_mixed_directory mixed-corpus 1.7 MiB 54 137.68ms 134.97ms -2.0% stable
tests/benchmarks/test_scan_benchmarks.py::test_detect_file_format_safe_pickle safe_model.pkl 49.4 KiB 1 162.4us 164.3us +1.2% stable
tests/benchmarks/test_scan_benchmarks.py::test_scan_safe_pickle safe_model.pkl 49.4 KiB 1 28.06ms 27.77ms -1.0% stable
tests/benchmarks/test_scan_benchmarks.py::test_scan_pytorch_zip state_dict.pt 1.5 MiB 1 33.56ms 33.58ms +0.1% stable

@mldangelo-oai mldangelo-oai merged commit 43913d6 into main Apr 11, 2026
25 checks passed
@mldangelo-oai mldangelo-oai deleted the mdangelo/codex/safetensors-boundary-audit branch April 11, 2026 05:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant